package com.wang.project.pay;

import com.wang.project.model.modle.PayModel;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 使用上下文维护算法策略
 */
@Component
public class PayContext {
    private PayStrategy strategy;

    public PayContext(PayStrategy strategy) {
        this.strategy = strategy;
    }

    public PayStrategyModel algorithmInterface(HttpServletRequest request, HttpServletResponse response, PayModel freshKeyPayModel) {
        return strategy.algorithmInterface(request, response, freshKeyPayModel);
    }
}
